package com.cxy.datawarehouse.controller;


import com.cxy.datawarehouse.biz.ElementTypeBiz;
import com.cxy.datawarehouse.entity.ElementType;
import com.cxy.datawarehouse.entity.StandardCodeType;
import com.cxy.datawarehouse.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags="元素类别管理")
@RestController
@Validated
@Slf4j
@RequestMapping("/elementType")
public class ElementTypeController {
    @Resource
    ElementTypeBiz elementTypeBiz;

    @GetMapping(value = "/list")
    @ApiOperation("元素类别列表")
    public Result<List<ElementType>> list() {
        List<ElementType> list = elementTypeBiz.list();
        return Result.ok(list);
    }

    @PostMapping(value = "/create")
    @ApiOperation("创建元素类别")
    public Result<Long> create(@RequestBody ElementType elementType) {
        elementTypeBiz.create(elementType);
        return Result.ok();
    }
}
